package com.likejian.rabbit.direct;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.likejian.rabbit.RabbitConfig;

@Component
public class DirectSender {

    @Autowired
    private AmqpTemplate rabbitTemplate;

    public void send(String msg, String routingKey) {
        System.out.println(msg);
        this.rabbitTemplate.convertAndSend(RabbitConfig.SPRINGBOOT_RABBIT_DIRECT_EXCHANGE, routingKey, msg);
    }

}